import 'package:flutter/material.dart';
import 'number_keyboard.dart';

class NumberKeyboardExample extends StatefulWidget {
  const NumberKeyboardExample({super.key});

  @override
  State<NumberKeyboardExample> createState() => _NumberKeyboardExampleState();
}

class _NumberKeyboardExampleState extends State<NumberKeyboardExample> {
  String _inputText = '';

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text('数字键盘示例'),
      ),
      body: Column(
        children: [
          Expanded(
            child: Center(
              child: Text(
                _inputText,
                style: const TextStyle(fontSize: 32),
              ),
            ),
          ),
          NumberKeyboard(
            onConfirm: (value) {
              ScaffoldMessenger.of(context).showSnackBar(
                SnackBar(content: Text('确认输入: $value')),
              );
            },
            onInput: (value) {
              setState(() {
                _inputText = value;
              });
            },
          ),
        ],
      ),
    );
  }
}